package projbd;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;

public class ProjBD {

    public static void main(String[] args) throws SQLException, UnsupportedEncodingException, FileNotFoundException, IOException {
        
        /* Parse the input files */
        
        XMLParser parser = new XMLParser();
        
        parser.addFile("input/hamlet.xml");

        long start, end;        
        
        /* Carga do BD */
        // start = System.currentTimeMillis();
        // parser.run();
        // System.out.println(parser.lines("input/hamlet.xml"));
        // end = System.currentTimeMillis();
        // System.out.println("Execution time was "+(end-start)+" ms.");
        
        // String test1 = new String("bbbbb");
        // String test2 = new String("aaa");
        // test1 = test1.replace(test1, test2);
        // test = test.replaceAll("\\\\", ".");
        // System.out.println(test1);
        
        // DataBaseOperations op = new DataBaseOperations("dblp");
        // start = System.currentTimeMillis();
        // op.query6();
        // end = System.currentTimeMillis();
        // System.out.println("Execution time was "+(end-start)+" ms.");
        // op.update("1.200", "teste", "NULL", "text", true);
        // op.delete("1");
//        start = System.currentTimeMillis();
//        op.delete("1.6");
//        op.delete("1.7");
//        op.delete("1.8");
//        op.delete("1.9");
//        op.delete("1.10");
//        op.delete("1.11");
//        op.delete("1.12");
//        op.delete("1.13");
//        op.delete("1.14");
//        op.delete("1.15");
//        // op.updateOperation();
//        end = System.currentTimeMillis();
        // System.out.println("Execution time was "+(end-start)+" ms.");
        
        XMLReconstructor xmlRec = new XMLReconstructor("input/hamlet_rec.xml");
        start = System.currentTimeMillis();
        xmlRec.reconstruct();
        end = System.currentTimeMillis();
        System.out.println("Execution time was "+(end-start)+" ms.");
    }
}
